package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import com.fr.report.script.core.FunctionHelper;

public class LOG10 extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    Object localObject = null;
    localObject = paramArrayOfObject[0];
    if (localObject instanceof Number)
      return FunctionHelper.parsePrimitiveDouble(Math.log(((Number)localObject).doubleValue()) / Math.log(10.0D));
    return new Integer(0);
  }

  public Function.Type getType()
  {
    return Function.MATH;
  }

  public String getCN()
  {
    return "LOG10(number):返回以 10 为底的对数。\nnumber: 用于常用对数计算的正实数。\n示例:\nLOG10(86) 等于 1.934498451\nLOG10(10) 等于 1\nLOG10(1E5) 等于 5\n";
  }

  public String getEN()
  {
    return "LOG10(number): Returns the base-10 logarithm of a number.\nNumber is the positive real number for which you want the base-10 logarithm.\n\nExample:\n   LOG10(86) = 1.934498451\n   LOG10(10) = 1\n   LOG10(1E5) = 5\n";
  }
}